'use strict';

module.exports = app => {
  const { STRING, INTEGER, ENUM, BOOLEAN, DATE } = app.Sequelize;

  const Conversation = app.model.define('conversation', {
    // 会话id
    id: {
      type: INTEGER,
      primaryKey: true,
      allowNull: false,
      autoIncrement: true
    },
    // 会话类型
    type: {
      type: ENUM,
      values: ['C2C', 'GROUP'],
      defaultValue: 'C2C',
      allowNull: false
    },
    // GROUP会话描述
    profile: {
      type: STRING,
      defaultValue: '当前暂无描述~' 
    },
    // C2C会话好友备注
    remark: {
      type: STRING
    },
    // 会话是否置顶
    is_pinned: {
      type: BOOLEAN,
      defaultValue: false,
      allowNull: false
    },
    created_at: DATE,
    updated_at: DATE
  })

  return Conversation
}

